public class test {
    public static void main(String[] args) {
        int a = 100;
        String str = "abcd";

        System.out.printf("%d\n", a);
        System.out.printf("%s\n", str);     //使用 printf 打印需要用到占位符和手动换行

        System.out.println(a);
        System.out.println(str);            //使用 println 打印会自动换行

        System.out.print(a);
        System.out.print(str);              //使用 print 打印需要手动换行
    }

    public static void func(String[] args) {
        final int a;                                //将变量a转换为常量，只能对其初始化一次
        a = 10;
        System.out.println(a);

        System.out.println(Integer.MAX_VALUE);      //Integer是int的包装类
        System.out.println(Integer.MIN_VALUE);
    }

    public static void main1(String[] args) {
        long n = 10L;                               //使用Long数据类型时必须在赋值后加上L

        System.out.println(n);                      //long 8个字节
        System.out.println(Long.MAX_VALUE);
        System.out.println(Long.MIN_VALUE);
    }

    public static void main2(String[] args) {
        short n = 10;                               //2个字节

        System.out.println(n);
        System.out.println(Short.MAX_VALUE);
        System.out.println(Short.MIN_VALUE);
    }

    public static void main3(String[] args) {
        byte n = 10;                                //1个字节

        System.out.println(n);
        System.out.println(Byte.MAX_VALUE);
        System.out.println(Byte.MIN_VALUE);
    }

    public static void main4(String[] args) {
        double n = 12.5;//double类型包含符号位、指数位、尾数

        System.out.println(n);
        System.out.println(Double.MAX_VALUE);//遵循IEE754标准
        System.out.println(Double.MIN_VALUE);

        int a = 1;
        int b = 2;
        System.out.println(a * 1.0 / b);

        double num = 1.1;
        System.out.println(num * num);
    }

    public static void main5(String[] args) {
        char ch = 97;
        System.out.println(ch);                 //a

        char ch2 = '高';
        System.out.println(ch2);

        System.out.println(Character.MAX_VALUE);
        System.out.println(Character.MIN_VALUE);
    }

    public static void main6(String[] args) {
        byte a = (byte)128;
        System.out.println(a);                  //-127
    }

    public static void main7(String[] args) {
        String a = "hello";
        String b = " world";

        System.out.println(a + b);              // + 拼接
    }

    public static void main8(String[] args) {
        String str = "123";
        int val = Integer.parseInt(str);        //字符串转换成整型
        System.out.println(val + 1);

        int a = 123;
        String ret = String.valueOf(a);         //整型转换成字符串
        System.out.println(a);
    }
}
